{extend name='layout/base' /}
{block name='title'}编辑管理员{/block}
{block name='contentHeader'}
<h1>
    用户管理
    <small>编辑管理员</small>
</h1>
<ol class="breadcrumb">
    <li><a href="#"><i class="fa fa-dashboard"></i> 用户管理</a></li>
    <li class="active">编辑管理员</li>
</ol>
{/block}
{block name='content'}
<script src="__PLUGIN__/bootstrapvalidator/js/bootstrapValidator.min.js"></script>
<link rel="stylesheet" href="__PLUGIN__/bootstrapvalidator/css/bootstrapValidator.min.css">
<script src="__PLUGIN__/iCheck/icheck.min.js"></script>
<link rel="stylesheet" href="__PLUGIN__/iCheck/all.css">
<!-- Horizontal Form -->
<div class="box box-info" style="width:90%;margin: 0 auto;">
    <div class="box-header with-border">
        <h3 class="box-title">用户参数</h3>
    </div>
    <!-- /.box-header -->
    <!-- form start -->
    <form class="form-horizontal" action="" method="post">
        <div class="box-body">
            <div class="form-group">
                <label for="tel" class="col-sm-2 control-label">电话号码</label>
                <div class="col-sm-10">
                    <input type="hidden" name="admin_id" value="{$admin.admin_id}" />
                    <input type="text" class="form-control" id="tel" name="tel" value="{$admin.tel}" placeholder="电话号码">
                </div>
            </div>
            <div class="form-group">
                <label for="admin_name" class="col-sm-2 control-label">管理员名称</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="admin_name" name="admin_name" value="{$admin.admin_name}" placeholder="管理员名称">
                </div>
            </div>
            <div class="form-group">
                <label for="unit" class="col-sm-2 control-label">管理员单位</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="unit" name="unit" value="{$admin.unit}" placeholder="管理员单位">
                </div>
            </div>
            <div class="form-group">
                <label for="admin_password" class="col-sm-2 control-label">管理员密码</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="admin_password" name="admin_password" value="{$admin.admin_password}" placeholder="管理员密码">
                </div>
            </div>
            <div class="form-group">
                <label for="admin_role" class="col-sm-2 control-label">管理员角色</label>
                <div class="col-sm-10">
                    {volist name='roles' id='role'}
                    <div class="radio">
                        <label>
                            <input type="radio" class="minimal" name="admin_role" value="{$key}" {if $admin.admin_role == $key}checked{/if}>
                            {$role}
                        </label>
                    </div>
                    {/volist}
                </div>
            </div>
        </div>
        <!-- /.box-body -->
        <div class="box-footer">
            <input type="hidden" name="__token__" value="{$Request.token}" />
            <button type="reset" class="btn btn-default">重置</button>
            <button type="submit" class="btn btn-info pull-right">提交</button>
        </div>
        <!-- /.box-footer -->
    </form>
</div>
<script type="text/javascript">
    //jQuery代码
    $(function () {
        //iCheck for checkbox and radio inputs
        $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
            checkboxClass: 'icheckbox_minimal-blue',
            radioClass: 'iradio_minimal-blue'
        });

        //bootstrapValidator
        $('form').bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                admin_name: {
                    message: '数据名验证失败',
                    validators: {
                        notEmpty: {
                            message: '管理员名称不能为空'
                        }
                    }
                },
                admin_password: {
                    message: '数据名验证失败',
                    validators: {
                        notEmpty: {
                            message: '管理员密码不能为空'
                        }
                    }
                },
                admin_role: {
                    validators: {
                        notEmpty: {
                            message: '管理员角色不能为空'
                        },
                        digits:{
                            message: '管理员角色必须填数字'
                        }
                    }
                }
            }
        });
    });
</script>
{/block}